package org.demo.entity;

import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.List;

@Data
@Accessors(chain = true)
public class User implements UserDetails, Serializable {
	private static final long serialVersionUID = 1L;
	private Long id;
	private String username;
	private String password;

	private List<Role> authorities;

	/**
	 * 用户账号是否过期
	 */
	@Override
	public boolean isAccountNonExpired() {
		return true;
	}

	/**
	 * 用户账号是否被锁定
	 */
	@Override
	public boolean isAccountNonLocked() {
		return true;
	}

	/**
	 * 用户密码是否过期
	 */
	@Override
	public boolean isCredentialsNonExpired() {
		return true;
	}

	/**
	 * 用户是否可用
	 */
	@Override
	public boolean isEnabled() {
		return true;
	}

}
